<template>
	<div>
		<div class="h2">寒暑假社会实践团队结项审批</div>
		<!-- <a-tabs
		      default-active-key="1"
		      tab-position="top"
		      :style="{ height: '200px' }"
		      @prevClick="callback"
		      @nextClick="callback"
		    >
		      <a-tab-pane v-for="(item, i) in menuList" :key="i" :tab="item.Name + '(' + item.TotalItemCount + ')'"></a-tab-pane>
		    </a-tabs> -->
		<a-tabs default-active-key="1" tab-position="left" :style="{ height: '600px', width: '270px' }"
			@change="onetabChange">
			<a-tab-pane style="width: 100%;" v-for="(item, i) in menuList" :key="i"
				:tab="item.Name + '(' + item.AwaitExamNum + ')'"></a-tab-pane>
		</a-tabs>
		<a-tabs class="childtab" default-active-key="1" tab-position="top" @change="tabChange">
			<a-tab-pane v-for="(items, m) in approveList" :key="m" :tab="items.Name"></a-tab-pane>
		</a-tabs>
		<div class="childmain" v-if="flowTypeID">
			<index v-show="tabkey == 0"  @shenpiFunClose="shenpiFunClose"  currentType="collegeFlow" :flowTypeID="flowTypeID" :currentState="0"></index>
			  <index v-show="tabkey == 1" @shenpiFunClose="shenpiFunClose"   currentType="collegeFlow" :flowTypeID="flowTypeID" :currentState="1"></index>
			<!--  <index v-if="flowTypeID!=''"   currentType="collegeFlow" :flowTypeID="flowTypeID" :currentState="currentState"></index>
			 -->
		<!-- 	<index v-if="flowTypeID!=''" v-show="tabkey == 1"  currentType="collegeFlow" :flowTypeID="flowTypeID" :currentState="1"></index>
			 -->
			<!-- <ActivityFlow1 v-show="tabkey == 0" :DepartCodeList="DepartCodeList" :ActivityTypeData="ActivityTypeData"
				:IsAgreeUpdate="IsAgreeUpdate" :flowTypeID="flowTypeID" ref="ActivityFlow1" @applyHander="applyHander"
				@allcheck="allcheck" @changeRow="changeRow"></ActivityFlow1>
			<ActivityFlow2 :DepartCodeList="DepartCodeList" :ActivityTypeData="ActivityTypeData" v-show="tabkey == 1"
				:IsAgreeUpdate="IsAgreeUpdate" :flowTypeID="flowTypeID" ref="ActivityFlow2"></ActivityFlow2> -->
		</div>

		<!-- <activityApplyExam :isShow="false" :text="text" :textArr="textArr" v-show="applyIf" @closeFun="closeFun">
		</activityApplyExam>
		<allExam :isShow="false" :text="textall" :textArr="textArrall" v-show="applyIfall" @closeFun="closeFun">
		</allExam>
		<add :text="text2" :ActivityTypeData="ActivityTypeData" v-show="addIf" @closeFun="closeFun">
		</add> -->
	</div>
</template>

<script>
	// import ActivityFlow1 from '../../../components/CreditFlow/ActivityFlow1.vue';
	// import ActivityFlow2 from '../../../components/CreditFlow/ActivityFlow2.vue';
	// import index from '@/components/views/PracticeTeam/index.vue';
	import index from '@/components/views/PracticeTeamDeclare/index.vue';
	import moment from 'moment';
	// import apply from './apply';
	// import add from './add';
	import activityApplyExam from '@/components/CreditFlow/activityApplyExam';
	// import allExam from '@/components/CreditFlow/allExam';
	import Func from '@/utils/func';
	import {
		GetActivityStateList,
		GetClubPageListCommon,
		ManageRolePracticeTeamFlowDoGetPracticeTeamFlowTypeList,
		ManageCreditFlowDoGetExamPageList,
		ManageUserScoreDoGetManageDepartList,
		GetActivityTypeList
	} from '@/api/follow';
	export default {
		components: {
			index
			//activityApplyExam,
			// allExam,
			// add,
			// ActivityFlow1,
			// ActivityFlow2
		},
		data() {
			return {
				currentState:0,
				DepartCodeList: [],
				ActivityTypeData: [],
				applyIf: false,
				form: this.$form.createForm(this, {
					name: 'advanced_search'
				}),
				textArrall: [],
				textall: {},
				applyIfall: false,
				addIf: false,
				text2:{},
				text: {},
				textArr: [],
				visible: false,
				confirmLoading: false,
				itemId: '',
				departmentList: [],
				worklist: [],
				tableHeight: parseFloat(window.innerHeight - 160),
				ActivityStateList: [],
				ClubList: [],
				tabkey: 0,
				menuList: [],
				flowTypeID: '',
				approveList: [{
						ID: 1,
						Name: '待审批'
					},
					{
						ID: 2,
						Name: '已审批'
					}
				],
				IsAgreeUpdate: false
			};
		},
		computed: {},
		created() {
			this.getList();
			this.getOtherList()
		},
		mounted() {},
		methods: {
			moment,
			callback(val) {},
			async getOtherList() {
				// let res = await GetActivityStateList();
				// this.ActivityStateList = res.data.data;
				let res = await ManageUserScoreDoGetManageDepartList();
				this.DepartCodeList = res.data.data;
				// let res3 = await GetActivityTypeList()
				// this.ActivityTypeData = res3.data.data
			},
			shenpiFunClose(){
				console.log('shenpiFunClose')
				this.getList2()
			},
			onetabChange(e) {
				// this.tabkey = 1
				this.flowTypeID = this.menuList[e].ID;
				this.IsAgreeUpdate = this.menuList[e].IsAgreeUpdate;
				// this.$refs.ActivityFlow1.getList();
				// this.$refs.ActivityFlow2.getList();
			},
			tabChange(e) {
				this.currentState = '';
				this.tabkey = e;
				this.currentState=e
			},
			filterOption(input, option) {
				return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
			},
			async getList2(){
				let res = await ManageRolePracticeTeamFlowDoGetPracticeTeamFlowTypeList({flowType:2});
				let list = res.data.data;
				this.menuList = list;
			},
			async getList() {
				// ManageRolePracticeTeamFlowDoGetPracticeTeamFlowTypeList

				let res = await ManageRolePracticeTeamFlowDoGetPracticeTeamFlowTypeList({flowType:2});
				let list = res.data.data;
				// for (let i = 0; i < list.length; i++) {
				// 	let examList = await ManageCreditFlowDoGetExamPageList({
				// 		flowTypeID: list[i].ID,
				// 		pageIndex: 1,
				// 		pageSize: 1
				// 	});
				// 	list[i] = {
				// 		...list[i],
				// 		TotalItemCount: examList.data.pageInfo.TotalItemCount
				// 	};
				// }
				this.menuList = list;
				this.flowTypeID = list[0].ID;
				console.log('ssssssssssssss')
				console.log(this.flowTypeID)
				this.IsAgreeUpdate = list[0].IsAgreeUpdate;
				// this.$nextTick(function () {
				//         this.$refs.ActivityFlow1.getList();
				// 				this.$refs.ActivityFlow2.getList();

				//       });
			},
			async fetchClub(value) {
				let myReg = /^[^a-zA-Z]+$/;
				if (value && value.length > 1) {
					let data = {};
					data.key = value;
					let res = await GetClubPageListCommon(data);
					this.ClubList = res.data.data;
				}
			},
			addList() {
				this.text = {};
				this.addIf = !this.addIf;
			},
			seeList(text, name) {
				let path = 'ActivityFlowDetail';
				this.$router.push({
					name: path,
					query: {
						ID: text.ID
					}
				});
			},
			changeRow(val){
				console.log(val);
				this.addIf=true
				this.text2=val
			},
			allcheck(values) {
				this.textall = values;
				this.applyIfall = true
			},
			applyHander(item) {
				if (Object.prototype.toString.call(item) == '[object Array]') {
					this.textArr = item;
				} else {
					this.text = item;
				}
				this.applyIf = true;
			},
			closeFun(data) {
				this.addIf=false;
				this.applyIf = false;
				this.applyIfall = false
				if (data == 1) {
					this.$refs.ActivityFlow1.getList();
					this.$refs.ActivityFlow2.getList();
				}
			}
		}
	};
</script>

<style lang="less" scoped>
	.activemain {
		width: 100%;
		display: flex;
	}

	.flex-1 {
		flex: 1;
	}

	.menu {
		width: 80px;
	}

	.menuli {
		height: 40px;
		line-height: 40px;
		background: #3b90f8;
		color: #fff;
		text-align: center;
	}

	/deep/.ant-form-item {
		display: flex;
		margin-bottom: 10px !important;

		/deep/.ant-form-item-label {
			width: 80px;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			text-align: right;
		}

		/deep/.ant-form-item-control-wrapper {
			flex: 1;
		}
	}

	/deep/.el-table th.is-leaf {
		background: #fafafa;
	}

	/deep/.el-table td,
	/deep/.el-table th {
		padding: 5px;
	}

	.option {
		margin-top: 10px;
		margin-bottom: 20px;
		overflow: hidden;
	}

	.option .btn {
		height: 36px;
		line-height: 36px;
		padding: 0 10px;
		float: left;
		background: #1890ff;
		color: #fff;
		margin-right: 10px;
		border-radius: 3px;
		cursor: pointer;
		border: none;
	}

	.foot {
		text-align: center;
		margin-top: 100px;
	}

	.el-pagination {
		margin-top: 10px;
	}

	.ant-form-item /deep/ .ant-form-item-control-wrapper {
		-webkit-box-flex: 1;
		-ms-flex: 1;
		flex: 1;
		min-width: 150px;
	}

	/deep/ .ant-form-item-control-wrapper {
		min-width: 200px;
	}

	.childtab {
		width: calc(~'100% - 270px');
		margin-left: 270px;
		margin-top: -600px;
	}

	.childmain {
		width: calc(~'100% - 270px');
		margin-left: 270px;
		margin-top: 0px;
	}
</style>
